import io.vertx.core.Vertx
import io.vertx.core.json.JsonObject
import io.vertx.redis.client.RedisOptions
import org.infinispan.commons.configuration.io.json.JsonConfigurationReader


class RedisConfig(vertx: Vertx?, path: String?)  {
    var sources: ArrayList<RedisOptions>? = null
        private set
    var poolSize = 0
        private set

    fun parse(jsonObject: JsonObject) {


        poolSize = jsonObject.getInteger("poolSize")
        sources = ArrayList()
        val sourcesJa = jsonObject.getJsonArray("sources")
        for (i in 0 until sourcesJa.size()) {
            val jo = sourcesJa.getJsonObject(i)
            val redisOpt = RedisOptions(jo)
            sources!!.add(redisOpt)
        }
    }
}